package com.wxb.pm.once;

import com.alibaba.excel.EasyExcel;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 导入数据到数据库
 */
public class ImportDB {
    public static void main(String[] args) {
        String fileName = "E:\\partner-matching\\pm-backend\\src\\main\\resources\\data1.xlsx";
        List<pmData> userInfoList = EasyExcel.read(fileName, pmData.class, new TableListener()).sheet().doReadSync();
        System.out.println("总数"+userInfoList.size());
        Map<String, List<pmData>> listMap =
                userInfoList.stream()
                        .filter(userInfo -> StringUtils.isNoneEmpty(userInfo.getUsername()))
                        .collect(Collectors.groupingBy(pmData::getUsername));
        System.out.println("不重复的数"+listMap.size());
    }
}

